﻿<UserControl x:Class="eventr.View.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:View="clr-namespace:eventr.View"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    Width="Auto" Height="Auto" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="797" d:DesignHeight="613" xmlns:SuperDeepZoom="clr-namespace:SuperDeepZoom;assembly=SuperDeepZoom">

    <UserControl.Resources>

        
        
        <Style x:Key="SpecialImageOverlayItemStyle" TargetType="SuperDeepZoom:SpecialImageOverlayItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="SuperDeepZoom:SpecialImageOverlayItem">
                        <Grid x:Name="SpecialOverlayRoot">                                   
                            <View:ImageOverlay/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


        <ControlTemplate x:Key="SpecialImageOverlayControlTemplate" TargetType="SuperDeepZoom:SpecialImageOverlay">
            <Grid x:Name="grid">
                <vsm:VisualStateManager.VisualStateGroups>
                    <vsm:VisualStateGroup x:Name="VisibilityStates">
                        <vsm:VisualStateGroup.Transitions>
                        </vsm:VisualStateGroup.Transitions>
                        <vsm:VisualState x:Name="Visible">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="00:00:00.0010000">
                                	<DiscreteObjectKeyFrame KeyTime="00:00:00">
                                		<DiscreteObjectKeyFrame.Value>
                                			<Visibility>Visible</Visibility>
                                		</DiscreteObjectKeyFrame.Value>
                                	</DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
                                	<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0.995"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>

                        </vsm:VisualState>
                        <vsm:VisualState x:Name="Invisible">
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
                                	<SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Visibility)">
                                	<DiscreteObjectKeyFrame KeyTime="00:00:00.6000000">
                                		<DiscreteObjectKeyFrame.Value>
                                			<Visibility>Collapsed</Visibility>
                                		</DiscreteObjectKeyFrame.Value>
                                	</DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>

                        </vsm:VisualState>
                    </vsm:VisualStateGroup>
                </vsm:VisualStateManager.VisualStateGroups>
                <ItemsPresenter/>
            </Grid>
        </ControlTemplate>

        <!--FlyThroughOverlayStyle allows customisation of the flythrough overlay-->
        <Style x:Key="FlyThroughOverlayStyle" TargetType="SuperDeepZoom:FlyThroughOverlayItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="SuperDeepZoom:FlyThroughOverlayItem">

                        <Grid x:Name="FlyThroughRoot" Height="20">

                            <!--Customise the overlay line here-->
                            <!--Ensure your controls stretch 100% wide, as the size will be altered
                                by code -->
                            <!--<Rectangle Height="10" VerticalAlignment="Center" Fill="Green" Margin="0,0,0,0" Width="Auto" />
                            <Ellipse HorizontalAlignment="Left" Margin="-10,0,0,0" Width="20" Fill="Red" Stroke="#FF000000" Height="20" VerticalAlignment="Center"/>
                            <Ellipse HorizontalAlignment="Right" Margin="0,0,-10,0" Width="20" Fill="Red" Stroke="#FF000000" Height="20" VerticalAlignment="Center"/>-->
                            
                            <View:FlyThoughOverlayLineDisplay/>
                            
                        </Grid>

                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        

        <ItemsPanelTemplate x:Key="FlyThroughOverlayItemsPanelTemplate">
            <Canvas/>
        </ItemsPanelTemplate>
        <ControlTemplate x:Key="FlyThroughOverlayControlTemplate" TargetType="SuperDeepZoom:FlyThroughOverlay">
        	<Grid x:Name="grid">
                <vsm:VisualStateManager.VisualStateGroups>
                    <vsm:VisualStateGroup x:Name="VisibilityStates">
                        <vsm:VisualStateGroup.Transitions>
                        </vsm:VisualStateGroup.Transitions>
                        <vsm:VisualState x:Name="Visible">
                        	<Storyboard>
                        		<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="00:00:00.0010000">
                        			<DiscreteObjectKeyFrame KeyTime="00:00:00">
                        				<DiscreteObjectKeyFrame.Value>
                        					<Visibility>Visible</Visibility>
                        				</DiscreteObjectKeyFrame.Value>
                        			</DiscreteObjectKeyFrame>
                        		</ObjectAnimationUsingKeyFrames>
                        		<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
                        			<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0.995"/>
                        		</DoubleAnimationUsingKeyFrames>
                        	</Storyboard>

                        </vsm:VisualState>
                        <vsm:VisualState x:Name="Invisible">
                        	<Storyboard>
                        		<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
                        			<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0"/>
                        		</DoubleAnimationUsingKeyFrames>
                        		<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Visibility)">
                        			<DiscreteObjectKeyFrame KeyTime="00:00:00.5000000">
                        				<DiscreteObjectKeyFrame.Value>
                        					<Visibility>Collapsed</Visibility>
                        				</DiscreteObjectKeyFrame.Value>
                        			</DiscreteObjectKeyFrame>
                        		</ObjectAnimationUsingKeyFrames>
                        	</Storyboard>

                        </vsm:VisualState>
                    </vsm:VisualStateGroup>
                </vsm:VisualStateManager.VisualStateGroups>
                <ItemsPresenter/>
            </Grid>
        </ControlTemplate>

        <ControlTemplate x:Key="SuperDeepZoomControlTemplate" TargetType="SuperDeepZoom:SuperDeepZoom">
            <Grid>
                
                <!--This is a control that is referenced by the TemplatePart in SuperDeepZoom.cs (right at the top)-->
                <MultiScaleImage x:Name="RootMultiScaleImage" KeyDown="LayoutRoot_KeyDown"/>

                <!--This is a control that is referenced by the TemplatePart in SuperDeepZoom.cs (right at the top)-->
                <SuperDeepZoom:FlyThroughOverlay x:Name="FlyThroughOverlay" ItemContainerStyle="{StaticResource FlyThroughOverlayStyle}" ItemsPanel="{StaticResource FlyThroughOverlayItemsPanelTemplate}" Template="{StaticResource FlyThroughOverlayControlTemplate}"/>
                <SuperDeepZoom:SpecialImageOverlay x:Name="SpecialImageOverlay" ItemContainerStyle="{StaticResource SpecialImageOverlayItemStyle}" ItemsPanel="{StaticResource FlyThroughOverlayItemsPanelTemplate}" Template="{StaticResource SpecialImageOverlayControlTemplate}"/>
            </Grid>
        </ControlTemplate>

    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="{x:Null}" KeyDown="LayoutRoot_KeyDown">

        <SuperDeepZoom:SuperDeepZoom x:Name="SuperDeepZoomer" ImageViewedJavaScriptFunction="someAdRotator" SpecialImageOverlayEnabled="{Binding SpecialImageOverlayEnabled}"  FlyThroughOverlayEnabled="{Binding FlyThroughOverlayEnabled}" FilterIds="{Binding FilterIds}" ImageContextData="{Binding ImageContextData}"  DeepZoomSource="{Binding DeepZoomSource}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Template="{StaticResource SuperDeepZoomControlTemplate}"/>
        <View:Navigation HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Next="Slideshow_Next" Previous="Slideshow_Previous"/>
        <View:ImageDetails SubImageMetadata="{Binding CurrentImageContext}" VerticalAlignment="Bottom" Height="Auto" Margin="0,0,0,24" d:LayoutOverrides="VerticalAlignment" HorizontalAlignment="Stretch" Width="Auto"/>
        <View:MainMenu HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Width="Auto" ZoomIn="MainMenu_ZoomIn" ZoomOut="MainMenu_ZoomOut" NavigateHome="MainMenu_NavigateHome" ToggleFullScreen="MainMenu_ToggleFullScreen" ToggleSlideShow="MainMenu_ToggleSlideShow"/>
        <View:FlyThroughInfoPopup x:Name="FlyThroughPopup" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,40" PlayFlyThrough="FlyThroughInfoPopup_PlayFlyThrough" HideFlyThrough="FlyThroughPopup_HideFlyThrough" ShowPopup="{Binding ShowFlyThoughInfoPopup}"/>        
    </Grid>
</UserControl>
